package top.kaoshanji.r2ch07d;

import org.springframework.aop.ThrowsAdvice;

import java.lang.reflect.Method;

/**
 * 代码清单-r2ch07d-238页b：定义一个异常增强，需要注意方法签名
 * @author kaoshanji
 * ^_^
 * create time 2025/5/7 17:53
 */
public class TransactionManager implements ThrowsAdvice {

    public void afterThrowing(Method method, Object[] args, Object target, Exception ex) throws Throwable {
        System.out.println("-----------");

        System.out.println("method：" + method.getName());
        System.out.println("抛出异常：" + ex.getMessage());
        System.out.println("成功回滚事务");

    }



}
